import cn.jja8.config.tool.YamlConfig;

import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;




public class test2 {
    @Retention(RetentionPolicy.RUNTIME)
    @interface C{}

    @C static byte aByte = 0;
    @C static short aShort = 12;
    @C static int anInt =10;
    @C static long aLong = 3000;
    @C static float aFloat = 12.8F;
    @C static double aDouble = 123.6;
    @C static boolean aBoolean = true;
    @C static char aChar = 'c';
    @C static String aString = "aaaabbbbcccc";
    @C static List<String> aList = Arrays.asList("aaaa","bbb");
    @C static Map<String,List<String>> stringListMap;
    @C static Map<List<String>,List<String>> listListMap;
    @C static File file = new File("一个文件.a");
    @C static URL url;
    @C static String[] arr = new String[]{"aaa","bbb","ccc"};
    @C static String[][][] arr3 = new String[][][]{{{"aaa","wwww"},{"www","sss"},{"ssss"}}, {{"sadas","dsdas"}}};
    @C static int[] intArr = new int[]{1,23,5,56,6,7,7,};
    @C static int[][][] intArrs = new int[][][]{{{1,23,5,56,6,7,7,}},{{34,54,5},{56,787,}}};
    @C static TTT ttt = new TTT();

    static {
        try {
            url = new URL("http://baidu.com/");
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
        stringListMap = new LinkedHashMap<>();
        stringListMap.put("aaaa",Arrays.asList("bbbb","cccc"));
        stringListMap.put("bbb",Arrays.asList("bbbb","cccc","aaaa"));
        stringListMap.put("dddd",Arrays.asList("bbbb"));

        listListMap = new LinkedHashMap<>();
        listListMap.put(Arrays.asList("aaa","bbbb"),Arrays.asList("ccc","ddd"));
        listListMap.put(Arrays.asList("aaa","bbbb","ddddd"),Arrays.asList("ccc","ddd"));
    }

    public static class TTT{
        @C byte aByte = 0;
        @C short aShort = 12;
        @C int anInt =10;
        @C long aLong = 3000;
        @C float aFloat = 12.8F;
        @C double aDouble = 123.6;
        @C boolean aBoolean = true;
        @C char aChar = 'c';
        @C String aString = "aaaabbbbcccc";
        @C List<String> aList = Arrays.asList("aaaa","bbb");
        @C Map<String,List<String>> stringListMap;
        @C Map<List<String>,List<String>> listListMap;
        @C File file = new File("一个文件.a");
        @C URL url;
        @C String[] arr = new String[]{"aaa","bbb","ccc"};
        @C String[][][] arr3 = new String[][][]{{{"aaa","wwww"},{"www","sss"},{"ssss"}}, {{"sadas","dsdas"}}};
        @C int[] intArr = new int[]{1,23,5,56,6,7,7,};
        @C int[][][] intArrs = new int[][][]{{{1,23,5,56,6,7,7,}},{{34,54,5},{56,787,}}};
        public TTT() {
            try {
                url = new URL("http://baidu.com/");
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
            }
            stringListMap = new LinkedHashMap<>();
            stringListMap.put("aaaa",Arrays.asList("bbbb","cccc"));
            stringListMap.put("bbb",Arrays.asList("bbbb","cccc","aaaa"));
            stringListMap.put("dddd",Arrays.asList("bbbb"));

            listListMap = new LinkedHashMap<>();
            listListMap.put(Arrays.asList("aaa","bbbb"),Arrays.asList("ccc","ddd"));
            listListMap.put(Arrays.asList("aaa","bbbb","ddddd"),Arrays.asList("ccc","ddd"));
        }
    }


    @Override
    public String toString() {
        return "test2{" +
                "aByte=" + aByte +
                ", aShort=" + aShort +
                ", anInt=" + anInt +
                ", aLong=" + aLong +
                ", aFloat=" + aFloat +
                ", aDouble=" + aDouble +
                ", aBoolean=" + aBoolean +
                ", aChar=" + aChar +
                ", aString='" + aString + '\'' +
                ", aList=" + aList +
                '}';
    }

    public static void main(String[] args){
        File file  = new File("text2.yml");
        new YamlConfig()
                .setAnnotationClass(C.class)
                .load(file)
                .as(test2.class)
                .save(file);

        System.out.println(new test2());

    }
}
